using System;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class ViewFlipper : StackPanel
	{
		private int mCuViewIndex;
		private int mPreViewIndex = -1;
		public ViewFlipper()
		{
			base.add_Loaded(new RoutedEventHandler(this.ViewFlipper_Loaded));
		}
		private void ViewFlipper_Loaded(object sender, RoutedEventArgs e)
		{
			for (int i = 0; i < base.get_Children().get_Count(); i++)
			{
				if (i == this.mCuViewIndex)
				{
					base.get_Children().get_Item(i).set_Visibility(0);
				}
				else
				{
					base.get_Children().get_Item(i).set_Visibility(1);
				}
			}
		}
		public void ShowView(int index)
		{
			if (index >= 0 && index < base.get_Children().get_Count())
			{
				if (index != this.mCuViewIndex)
				{
					this.mPreViewIndex = this.mCuViewIndex;
					this.mCuViewIndex = index;
					if (this.mPreViewIndex >= 0 && this.mPreViewIndex < base.get_Children().get_Count())
					{
						base.get_Children().get_Item(this.mPreViewIndex).set_Visibility(1);
					}
					base.get_Children().get_Item(this.mCuViewIndex).set_Visibility(0);
				}
				return;
			}
		}
		public int GetCuViewIndex()
		{
			return this.mCuViewIndex;
		}
	}
}
